package com.example.xpvideo.Controller;

import com.example.xpvideo.entity.PageResult;
import com.example.xpvideo.entity.ResponseResult;
import com.example.xpvideo.entity.req.UpdateReq;
import com.example.xpvideo.entity.req.UserListReq;
import com.example.xpvideo.entity.res.AdminListRes;
import com.example.xpvideo.entity.res.PhpLocalAdminRes;
import com.example.xpvideo.service.PhpLocalAdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * @author : 洪俊新
 * @date : 2021/8/25 18:15
 * @description:
 */
@RestController
@RequestMapping("/back/phpadmin")
public class PhpLocalAdminController {
    @Autowired
    private PhpLocalAdminService phpLocalAdminService;

    /**
     * 所有用户列表
     * */
    @GetMapping("/list")
    public ResponseResult<PageResult<List<PhpLocalAdminRes>>> list(UserListReq userListReq)
            throws Exception{
        return phpLocalAdminService.list(userListReq);
    }

    /**
     * 冻结/解冻用户
     * */
    @PostMapping("/updatestage")
    public ResponseResult<Object> updateStage(@NotNull @RequestBody UpdateReq updateReq) throws Exception{
        return phpLocalAdminService.updateLMStage(updateReq);
    }
}
